<!doctype html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Vv - 排名助手</title>
    <meta name="description" content="VV,Vv排名助手,排名助手,排名软件,竞价软件,调价软件,查看百度推广异地排名." />
    <meta name="keywords" content="VV,Vv排名助手,排名助手,排名软件,竞价软件,调价软件,查看百度推广异地排名" />
    <link href="/static/style.css" rel="stylesheet" type="text/css"/>
    <script language="javascript" type="text/javascript" src="/static/util.js"></script>
    <script language="javascript" type="text/javascript" src="/static/jquery.min.js"></script>
    <script language="javascript" type="text/javascript" src="/static/jquery.url.js"></script>
    <script language="javascript" type="text/javascript" src="/static/jquery.cookie.js"></script>
</head>
<script>
    var deviceBrowserList = <%- deviceBrowserList%>;
</script>
<style>
    #region_ul li{
        color: #3E62A6;
        float: left;
        margin: 0 10px 0 0;
        font-size: 13px;
        cursor: pointer;

    }
    #region_ul .select{
        color:#000000;
        font-weight: bold;
    }
</style>
<div>
    <table cellpadding="0" cellspacing="0" align="center" width="100%" class="t1">
        <tr bgcolor="#ededed">

            <td rowspan="2" width="20"></td>
            <td rowspan="2" width="150" height="30" charoff="4"><a href="/"><b>Vv - 排名助手</b></a></td>
            <td   style="padding: 5px 0 0 0">
                <b style="margin: 0 5px 0 0">网址:</b><input id="url" value="例如输入:www.baidu.com" data="例如输入:www.baidu.com" type="text" name="url" style="width: 500px" />
                <input type="button" value="前往" id="go_url"/><input type="button" value="设置为首页" id="index_url"/>
            </td>
            <td style="width: 500px">
                <select id="use_url" onchange="changeUseUrl(this)"><option value="0">常用网址</option></select>
                <select id="region_id" onchange="changeRegion(this)"><%-regionOption%></select>
                <select id="browser_id" onchange="changeBrowser(this)"><%-browserOption%></select>
                <select id="device_id" onchange="changeDev(this)"><%-devOption%></select>
            </td>
</tr>
<tr bgcolor="#ededed"><td colspan="4" style="height: 20px;">
        <ul id="region_ul">
            <% var len = regionlist.length;for(var i=0;i<len;i++){ var rid = regionlist[i].id;var name = regionlist[i].name %><li id='li_<%-rid%>' onclick='changeRegionLi(<%-rid%>)'><%-name.substr(0,2)%></li>&nbsp;<%}%>
        </ul>
    </td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" align="center" width="100%" class="t1">
    <tr bgcolor="#6699cc">
        <td colspan="5" height="2" ></td>
    </tr>
</table>
</div>
<input type="hidden" value="" id="keyword"/>
<input type="hidden" value="" id="weburl"/>
<table cellpadding="0" cellspacing="0" align="center" width="100%" class="t2"><tbody><tr><td>
            <iframe width="100%" height="500px;" frameborder="0" src="<%=index_url%>" style="boder:0;height:500px;width:100%;" id="preview" name="preview"></iframe>
        </td></tr></tbody></table>
<script>
    //设置默认值
    $("#region_id").val(<%-regionid%>);
    changeRegionLi(<%-regionid%>,false);
    $("#search_id").val(<%-searchid%>);
    $("#device_id").val(<%-deviceid%>);
    $("#browser_id").val(<%-browserid%>);

    function searchEnd(searchUrl){
        $("#url").val(searchUrl);
    }

    function setUseUrl(){
        var use_url = $.cookie('use_url');
        var optionStr = '<option value="0">常用网址</option>';
        if(use_url!=undefined && use_url!=""){
            var arr = use_url.split("#");
            var len = arr.length;
            for(var i=0;i<len;i++){
                optionStr += '<option value="'+arr[i]+'">'+arr[i]+'</option>'
            }
            $("#use_url").html(optionStr);
        }
    }

    function changeUseUrl(obj){
        $("#url").val($(obj).val());
        go();
    }

    function setKeyword(keyword){
        $("#keyword").val(keyword);
    }

    function changeSearch(obj){
        $.cookie('searchid',$(obj).val())
        go()
    }
    function changeDev(obj){
        var devid = obj.value;
        var browserObj = document.getElementById("browser_id")
        var oldbrowser = browserObj.options[browserObj.selectedIndex].text
        slist = deviceBrowserList[devid];
        optionStr = "<option value='0'>当前浏览器</option>";
        for(var i in slist){
            name = slist[i]['name'];
            iid = slist[i]['id'];
            if(trim(oldbrowser).toLowerCase() == trim(name).toLowerCase()){
                s = "selected='selected'";
            }else{
                s = '';
            }
            optionStr += "<option "+s+" value='"+iid+"'>"+name+"</option>";
        }
        $("#browser_id").html(optionStr);
        setBrowser()
        $.cookie('deviceid',devid)
        go()
    }

    function changeBrowser(obj){
        setBrowser()
        go()
    }

    function setBrowser(){
        //console.log("ssss")
        $.cookie('browserid',$("#browser_id").val());
    }

    function changeRegion(obj){
        changeRegionLi(obj.value)
    }

    function changeRegionLi(val,isGo){
        $("#region_id").val(val);
        $.cookie('regionid',val)
        id = "li_"+val;
        $("#region_ul li").each(function(){
            $(this).removeClass("select")
        })
        $("#"+id).addClass("select")
        $.cookie('regionname',$("#"+id).html())
	if(isGo==undefined || isGo==true){
		go()
	}
    }

    var interTimout;
    var interTimoutSocket;
    var reqTime = 1;
    var nowReqid = 0;
    var nowRegionid = 0;
    var nowResdata = "";
    var nowServerurl = "";

    function isDeny(url){
        $.url.setUrl(url);
        var host = $.url.attr('host').toLowerCase();
        var denyHost = ['www.baidu.com','www.so.com','www.soso.com','www.sogou.com','m.so.com','wap.sogou.com','m.soso.com','m.baidu.com'];
        if(denyHost.indexOf(host)<0){
            return false;
        }
        return true;
    }


    function go(url){
        var getdata = {}
        getdata["regionid"] = $("#region_id").val();
        getdata["browserid"] = $("#browser_id").val();
        getdata["deviceid"] = $("#device_id").val();

        if(url==undefined || url==""){
            var url = decodeURIComponent($.trim($("#url").val()));
        }

        if(url==$.trim($("#url").attr("data"))){
            alert("请输入网址");
            return false;
        }

        if(url.substr(0,7)!="http://"){
            url = "http://"+url;
        }
        if(!isDeny(url)){
            alert("目前支持部分url");
            return false;
        }
        getdata["url"] = encodeURIComponent(url);

        var src = "/<%-searchPath%>?"+buildGet(getdata);
        document.getElementById("preview").src = src;
        return false;
    }

    function showErr(){
        var ifobj = document.getElementById("preview").contentWindow
        ifobj.document.getElementById("loading").style.display = "none";
        ifobj.document.getElementById("loadingerr").style.display = "block";
        try{
            clearInterval(interTimout);
        }catch(err){}
    }

    function dyniframesize(down) {
        var pTar = null;
        if (document.getElementById){
            pTar = document.getElementById(down);
        }else{
            eval('pTar = ' + down + ';');
        }

        if (pTar && !window.opera){
            //begin resizing iframe
            pTar.style.display="block" ;
            if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight){
                //ns6 syntax
                pTar.height = pTar.contentDocument.body.offsetHeight +20;
                pTar.width = pTar.contentDocument.body.scrollWidth-20;
            }else if (pTar.Document && pTar.Document.body.scrollHeight){
                //ie5+ syntax
                pTar.height = pTar.Document.body.scrollHeight;
                pTar.width = pTar.Document.body.scrollWidth-20;
            }
        }
    }

    function dynbodysize() {
        var previewObj = document.getElementById("preview");
        if(previewObj!=null){
            if (document.documentElement.clientHeight || document.body.clientHeight){
                h = document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
                previewObj.style.height = (h - 101) + "px";
            }
            dyniframesize('preview');
        }
    }

    dynbodysize();
    window.onresize = function(){dynbodysize();};
    $("#url").focus(function(){
        if( $.trim($(this).val()) == $.trim($(this).attr("data"))){
            $(this).val("");
        }
    });
    $("#url").blur(function(){
        if( $.trim($(this).val()) == ""){
            $(this).val( $.trim($(this).attr("data")) );
        }
    });

    $("#go_url").click(function(){
        go();
    });

    $('#url').bind('keypress',function(event){
        if(event.keyCode == "13")
        {
            $("#go_url").click();
        }
    });

    $("#index_url").click(function(){
        var url = $.trim($("#url").val());
        if(url.substr(0,7)!="http://"){
            url = "http://"+url;
        }

        if(url==$.trim($("#url").attr("data")) || url==""){
            alert("请输入网址");
            return false;
        }
        if(!isDeny(url)){
            alert("目前支持部分url");
            return false;
        }
        $.get("/setIndexUrl?url="+encodeURIComponent(url),function(){
            alert("设置成功");
        });
    })

    setUseUrl();
</script>

<table cellpadding="0" cellspacing="0" align="center" width="100%" class="t1">
    <tr bgcolor="#6699cc" style="height: 1px;">
        <td colspan="3" height="1" ></td>
    </tr>
    <tr style="border-top:solid 1px #6699cc ;height: 41px;">
	<td>©2014 Vvtool&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a style="color: red;" href="http://bcs.duapp.com/vvtool/vvtool.zip">VV排名助手批量查看排名客户端 下载</a>  </td>
	<td style="text-align: center;"><span style="font-weight: bold;font-size: 14px;">广告服务&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;排名软件定制&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;建站服务&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;请联系QQ:2020475057&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
        <td style="width: 280px">
            <!-- Baidu Button BEGIN -->
            <div id="bdshare" class="bdshare_t bds_tools get-codes-bdshare">
                <span class="bds_more">分享到：</span>
                <a class="bds_qzone"></a>
                <a class="bds_tsina"></a>
                <a class="bds_tqq"></a>
                <a class="bds_renren"></a>
                <a class="bds_t163"></a>
                <a class="shareCount"></a>
            </div>
            <!-- Baidu Button END -->
        </td>
    </tr>
</table>
</body>
<!--统计 start-->
<%-tongji_normal%>
<!--统计 end-->

<script language="javascript" type="text/javascript" src="/static/common.js"></script>
<!--百度分享 start-->
<script type="text/javascript" id="bdshare_js" data="type=tools&amp;uid=6752031" ></script>
<script type="text/javascript" id="bdshell_js"></script>
<script type="text/javascript">
    document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + Math.ceil(new Date()/3600000)
</script>
<!--百度分享 end-->
<html>
